package 作业1;

public class ThreadJoin implements Runnable {

    Thread A,B;

    int number =0;

    public ThreadJoin() {

        A= new Thread(this);

        B =new Thread(this);

    }

    public void run() {

        if(Thread.currentThread()==A) {

            try{

                B.start();

                B.join();

            }
            catch(InterruptedException e){}

            number = number/2;

            System.out.printf("%d",number);//【代码】

        }       else if(Thread.currentThread()==B) {

            number = 100;

        }   }

    public static void main(String s[]) {

        ThreadJoin  join = new ThreadJoin();

        join.A.start();

    } }
